package string;
/*
        boolean matches(String regex) : 校验调用方法的字符串对象是否符合传入的正规规则
 */

public class StringDemo8 {
    public static void main(String[] args) {
        //校验车牌号
        String num = "疆A012CB";

        boolean matches = num.matches("[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-HJ-NP-Z]" +
                "{1}[A-HJ-NP-Z]{1}[A-HJ-NP-Z0-9]{4,5}[A-HJ-NP-Z0-9挂学警港澳]{1}");

        System.out.println("matches = " + matches);

        String str1 = "HelloWorld";
        String str2 = "Hello     World";
        String str3 = "     Hello     World     ";

        System.out.println("str1.trim() = " + str1.trim());
        System.out.println("str2.trim() = " + str2.trim());
        System.out.println("str3.trim() = " + str3.trim());
    }
}
